package com.tangyuan.observer;

/**
 * @Author tangyuan
 * @Description:
 * @Data 2018/4/5
 */
public class PadDisplay implements Observer, DisplayElement{
    private Subject weatherData;
    private float temperature;

    public PadDisplay(Subject weatherData){
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    @Override
    public void display(Object o) {

        System.out.println("PadDisplay 正在播放现在气温： " + o.toString());
    }

    @Override
    public void update(float temperature) {
        this.temperature = temperature;
        display(temperature);
    }
}
